package fitnesshub.controller.member;

import fitnesshub.pojo.dto.CoursePageQueryDTO;
import fitnesshub.result.PageResult;
import fitnesshub.result.Result;
import fitnesshub.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户-课程
 */
@RestController
@RequestMapping("/member/course")
@Slf4j
public class MemberCourseController {
    @Autowired
    private CourseService courseService;

    /**
     * 课程分页
     *
     * @param coursePageQueryDTO
     * @return
     */
    @GetMapping("/page")
    public Result<PageResult> page(CoursePageQueryDTO coursePageQueryDTO) {
        log.info("课程分页查询，参数：{}", coursePageQueryDTO);
        PageResult pageResult = courseService.page(coursePageQueryDTO);
        return Result.success(pageResult);
    }
}
